﻿using System.IO;
using System.Reflection;
using Microsoft.Phone.Controls;

namespace DevPhoneToolkitSample.Samples
{
    public partial class HtmlAttachedSample : PhoneApplicationPage
    {
        public HtmlAttachedSample()
        {
            InitializeComponent();
            DataContext = this;
        }

        public string SourceHtml
        {
            get
            {
                string result = null;
                using (var resourceStream =
                        Assembly.GetExecutingAssembly().GetManifestResourceStream("DevPhoneToolkitSample.Data.HtmlSample.html"))
                {
                    //Verify if the resource is valid
                    if (resourceStream != null)
                    {
                        //Prepare the stream to read
                        using (var resourceReader = new StreamReader(resourceStream))
                        {
                            // Read the stream and get the html
                            result = resourceReader.ReadToEnd();
                        }
                    }
                }
                return result;
            }
        }
    }
}